package com.abso.mp3tunes.locker.core.data;

import java.util.HashMap;
import java.util.Map;

/**
 * The abstract base class for Locker information objects.
 */
public abstract class AbstractLockerData {

	/** A table with application defined property key/value pairs. */
	private Map data;

	/**
	 * Returns an application defined property with the specified name, or
	 * <code>null</code> if it has not been set.
	 * 
	 * @param key
	 *            the name of the property.
	 * @return the value of the property, or <code>null</code> if it has not
	 *         been set.
	 * 
	 */
	public Object getData(String key) {
		if (data == null) {
			return null;
		} else {
			return data.get(key);
		}
	}

	/**
	 * Sets an application defined property with the specified name.
	 * 
	 * @param key
	 *            the name of the property.
	 * @param value
	 *            the value of the property.
	 */
	public void setData(String key, Object value) {
		if (data == null) {
			data = new HashMap();
		}
		data.put(key, value);
	}

}
